package base.day22.file;

import java.io.File;

public class MyFlie5 {
    public static void main(String[] args) {
        File f1=new File("E:\\text\\java text");
        deleteFile(f1);
    }

    private static void deleteFile(File f1) {
        //遍历得到文件夹里面的对象
        File[] files = f1.listFiles();
        for (File file : files) {
            if (file.isFile()){
                file.delete();
            }
            else {
                deleteFile(file);
            }
        }
        f1.delete();

    }
}
